//
//  GameRightTableViewCell.m
//  Vlink
//
//  Created by LJH on 2017/9/5.
//  Copyright © 2017年 myTV. All rights reserved.
//

#import "GameRightTableViewCell.h"

@interface GameRightTableViewCell()
@property (nonatomic, strong) UIImageView *gameImage;
@property (nonatomic, strong) UILabel *name;
@property (nonatomic, strong) UILabel *subName;
@property (nonatomic, strong) UIView *bottomView;
@property (nonatomic, strong) UIView *rightView;

@end
@implementation GameRightTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor clearColor];
        UIView *bgView = [[UIView alloc] init];
        bgView.backgroundColor = [UIColor whiteColor];
        bgView.layer.cornerRadius = 5;
        bgView.layer.masksToBounds = YES;
        [self.contentView addSubview:bgView];
        [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.left.equalTo(self.contentView).offset(5);
            make.center.equalTo(self.contentView);
        }];
        
        UIImageView *gameImage = [[UIImageView alloc] init];
        gameImage.layer.cornerRadius = 5;
        gameImage.layer.masksToBounds = YES;
        [bgView addSubview:gameImage];
        [gameImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.height.equalTo(bgView.mas_height).offset(-10);
            make.left.equalTo(bgView).offset(5);
            make.centerY.equalTo(bgView);
        }];
        self.gameImage = gameImage;
        
        UILabel *name = [[UILabel alloc] initWithFrame:CGRectZero];
        name.font = [UIFont systemFontOfSize:14];
        name.textColor = kColor333333;
        [bgView addSubview:name];
        [name mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(gameImage.mas_right).offset(5);
            make.top.equalTo(gameImage);
            make.right.equalTo(bgView);
        }];
        self.name = name;
        
        UILabel *subName = [[UILabel alloc] initWithFrame:CGRectZero];
        subName.font = [UIFont systemFontOfSize:12];
        subName.textColor = kColor888888;
        [bgView addSubview:subName];
        [subName mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(name);
            make.top.equalTo(name.mas_bottom).offset(10);
            make.right.equalTo(name);
        }];
        self.subName = subName;
        

    }
    return self;
}

- (void)setGameModel:(GameModel *)gameModel
{
    _gameModel = gameModel;
    [self.gameImage yy_setImageWithURL:[NSURL URLWithString:gameModel.gameDetail.iconUrl] placeholder:placeholder_image];
    self.name.text = gameModel.gameDetail.mainTitle;
    self.subName.text = [NSString stringWithFormat:@"%@", gameModel.commentTotal];
}

@end
